<template>
  <div class="layui-fluid">
    <div class="layui-card">
      <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
        <ul class="layui-tab-title">
          <li class="layui-this">流程列表</li>
          <li>部署流程</li>
          <li>运行中流程</li>
        </ul>
        <div class="layui-tab-content">
          <ProcessList></ProcessList>
          <DeployProcess></DeployProcess>
          <RuntimeProcessList></RuntimeProcessList>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import ProcessList from "./children/ProcessList";
import DeployProcess from "./children/DeployProcess";
import RuntimeProcessList from "./children/RuntimeProcessList";
export default {
  name: "Model",
  components: { ProcessList, DeployProcess, RuntimeProcessList },
  data: function () {
    return {
      model: {},
    };
  },
  mounted: function () {
    // this.initLayui();
    // this.queryModelList();
  },
  methods: {
    queryModelList: function (where) {
      if (this.checkIsNull(where)) {
        where = {};
      }
      var obj = {};
      obj.url = this.activitiModel + "/modelList";
      obj.cols = this.cols;
      obj.tableId = "dataTable";
      obj.where = where;
      this.renderTable(obj); //其中url tableId以及cols为必传其他参数个性化参数请参考layui数据表格
    },
    edit: function (data, obj) {
      window.open("/static/activiti/modeler.html?modelId=" + data.id);
    },
    deploy: function (data, obj) {
      var that = this;
      this.post(
        this.activitiModel + "/deploy",
        {
          modeId: data.id,
        },
        function (res) {
          console.log(res);
          if (res.code == "000000") {
            that.openMsg(res.msg, true);
          } else {
            that.showMsg(res.msg, false);
          }
        }
      );
    },
    modelExport: function (data, obj) {
      var that = this;
      this.post(
        this.activitiModel + "/export",
        {
          modeId: data.id,
        },
        function (res) {
          if (res.code == "000000") {
            that.openContent({
              title: data.name + "流程XML",
              content: '<pre id="activitixml">' + res.result + "</pre>",
            });
            layui.use("code", function () {
              layui.code({
                elem: "#activitixml",
                about: false,
                skin: "notepad",
                encode: true,
              });
            });
          } else {
            that.showMsg(res.msg, false);
          }
        }
      );
    },
  },
};
</script>